import { createRouter, createWebHistory } from "vue-router";
import Center from "../components/Center.vue";
import List from "../view/List.vue";
import User from "../components/User.vue";
import NavBar from "../view/NavBar.vue";
import Cinemas from "../view/Cinemas.vue"
import Search from "../view/Search.vue"
import City from "../view/City.vue"
import Detail from "../view/Detail.vue"
import Setting from "../components/Setting.vue"
import listCinemas from "../view/listCinemas.vue"
import CinemasFilm from "../view/CinemasFilm.vue"
import "../store/index"
import listStore from "../store/index";

const router = createRouter({
  history: createWebHistory(), //路由模式为 history
  routes: [
    { path: "/", component: List },

    {
      path: "/list",
      component: List,
      children: [
        {
          path: "/navbar",
          component: NavBar,
        },
      ],
    },
    {path:"/list/:filmId",name:"film",component: Detail },

    { path: "/user", component: User },
    { path:"/cinemas",component: Cinemas,},
    { path: "/cinemas/search", component: Search},
    { path: "/city",component: City},
    { path: "/center",component: Center},
    { path: "/center/setting",name:"setting",component: Setting},
    { path: "/list/:filmId/cinemas",name:"listCinemas",component: listCinemas},
    { path: "/cinemas/:cinemaId/film",component: CinemasFilm}
  ],
  
});

router.afterEach((to, from, next) => {
  window.scrollTo(0,0)
  // next();
});

export default router;
